const express = require("express");
const router = express();
const config = require("./config");

const base_url = "http://" + config.IP + ":" + config.PORT + "/images/";

const category_url = base_url + "category/";

router.post("/", (req, res) => {

    var id = req.query.id;
    console.log("传过来的参数：id = " + id);
    console.log(`<-- homePageContent -->`);
    var data = {
        "code" : "0000",
        "message" : "success",
        "data" : {
            // bannber轮播图
            "slides": [
                {
                    "image": base_url + "banner/1.png",
                    "goodsId": "001"
                },
                {
                    "image": base_url + "banner/2.png",
                    "goodsId": "002"
                },
                {
                    "image": base_url + "banner/3.png",
                    "goodsId": "003"
                },
                {
                    "image": base_url + "banner/4.png",
                    "goodsId": "004"
                }
            ],
            // 商品推荐上层
            recommend: [
                {
                    "name": "111111111111111",
                    "image": base_url + "goods/001/cover.jpg",
                    "presentPrice": 98.88,
                    "goodsId": "001",
                    "oriPrice": 108.88
                },
                {
                    "name": "22222222",
                    "image": base_url + "goods/002/cover.jpg",
                    "presentPrice": 229.90,
                    "goodsId": "002",
                    "oriPrice": 329.90
                },
                {
                    "name": "3333333333",
                    "image": base_url + "goods/003/cover.jpg",
                    "presentPrice": 318.88,
                    "goodsId": "001",
                    "oriPrice": 388.88
                },
                {
                    "name": "444444444",
                    "image": base_url + "goods/004/cover.jpg",
                    "presentPrice": 238.88,
                    "goodsId": "001",
                    "oriPrice": 258.88
                },
                {
                    "name": "55555555",
                    "image": base_url + "goods/005/cover.jpg",
                    "presentPrice": 312.00,
                    "goodsId": "001",
                    "oriPrice": 399.00
                },
                {
                    "name": "66666666",
                    "image": base_url + "goods/006/cover.jpg",
                    "presentPrice": 99.99,
                    "goodsId": "001",
                    "oriPrice": 199.99
                },
                {
                    "name": "777777777",
                    "image": base_url + "goods/007/cover.jpg",
                    "presentPrice": 315.88,
                    "goodsId": "001",
                    "oriPrice": 355.88
                },
                {
                    "name": "888888888888",
                    "image": base_url + "goods/008/cover.jpg",
                    "presentPrice": 888.88,
                    "goodsId": "001",
                    "oriPrice": 999.99
                },
            ],
            // 商品中间广告
            "floor1Pic" :{
                "PICTURE_ADDRESS": base_url + "advert/ad02.jpg",
                "TO_PLACE": "4"
            },
            //商品底部推荐
            "floor1": [
                {
                    "image": base_url + "floor/1.jpg",
                    "goodsId": "001"
                },
                {
                    "image": base_url + "floor/2.jpg",
                    "goodsId": "002"
                },
                {
                    "image": base_url + "floor/3.jpg",
                    "goodsId": "003"
                },
                {
                    "image": base_url + "floor/4.jpg",
                    "goodsId": "004"
                },
                {
                    "image": base_url + "floor/5.jpg",
                    "goodsId": "005"
                },
                {
                    "image": base_url + "floor/6.jpg",
                    "goodsId": "006"
                },
                {
                    "image": base_url + "floor/7.jpg",
                    "goodsId": "007"
                },
                {
                    "image": base_url + "floor/8.jpg",
                    "goodsId": "008"
                },
                {
                    "image": base_url + "floor/9.jpg",
                    "goodsId": "009"
                },
                {
                    "image": base_url + "floor/10.jpg",
                    "goodsId": "0010"
                }
            ],
            // 商品分类
            category: [
                {
                    "firstCategoryId": "1",
                    "firstCategoryName": "毛衣",
                    "secondCategoryVO":[{
                        "secondCategoryId": "11",
                        "firstCategoryId": "1",
                        "secondCategoryName": "羊绒",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "1.png"
                },
                {
                    "firstCategoryId": "2",
                    "firstCategoryName": "西服",
                    "secondCategoryVO":[{
                        "secondCategoryId": "21",
                        "firstCategoryId": "2",
                        "secondCategoryName": "小西服",
                        "comments": ""
                    },{
                        "secondCategoryId": "22",
                        "firstCategoryId": "2",
                        "secondCategoryName": "职业装",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "2.png"
                },
                {
                    "firstCategoryId": "3",
                    "firstCategoryName": "皮衣",
                    "secondCategoryVO":[{
                        "secondCategoryId": "31",
                        "firstCategoryId": "3",
                        "secondCategoryName": "真皮皮衣",
                        "comments": ""
                    },{
                        "secondCategoryId": "32",
                        "firstCategoryId": "3",
                        "secondCategoryName": "仿皮皮衣",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "3.png"
                },
                {
                    "firstCategoryId": "4",
                    "firstCategoryName": "连衣裙",
                    "secondCategoryVO":[{
                        "secondCategoryId": "41",
                        "firstCategoryId": "4",
                        "secondCategoryName": "半身裙",
                        "comments": ""
                    },{
                        "secondCategoryId": "42",
                        "firstCategoryId": "4",
                        "secondCategoryName": "打底裙",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "4.png"
                },
                {
                    "firstCategoryId": "5",
                    "firstCategoryName": "牛仔裤",
                    "secondCategoryVO":[{
                        "secondCategoryId": "51",
                        "firstCategoryId": "5",
                        "secondCategoryName": "阔腿牛仔裤",
                        "comments": ""
                    },{
                        "secondCategoryId": "52",
                        "firstCategoryId": "5",
                        "secondCategoryName": "紧身牛仔裤",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "5.png"
                },
                {
                    "firstCategoryId": "6",
                    "firstCategoryName": "T恤",
                    "secondCategoryVO":[{
                        "secondCategoryId": "61",
                        "firstCategoryId": "6",
                        "secondCategoryName": "印花T恤",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "6.png"
                },
                {
                    "firstCategoryId": "7",
                    "firstCategoryName": "运动装",
                    "secondCategoryVO":[{
                        "secondCategoryId": "71",
                        "firstCategoryId": "7",
                        "secondCategoryName": "春季运动装",
                        "comments": ""
                    },{
                        "secondCategoryId": "72",
                        "firstCategoryId": "7",
                        "secondCategoryName": "秋季运动装",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "7.png"
                },
                {
                    "firstCategoryId": "8",
                    "firstCategoryName": "短裙",
                    "secondCategoryVO":[{
                        "secondCategoryId": "81",
                        "firstCategoryId": "8",
                        "secondCategoryName": "宽松",
                        "comments": ""
                    },{
                        "secondCategoryId": "82",
                        "firstCategoryId": "8",
                        "secondCategoryName": "包臀",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "8.png"
                },
                {
                    "firstCategoryId": "9",
                    "firstCategoryName": "礼服",
                    "secondCategoryVO":[{
                        "secondCategoryId": "91",
                        "firstCategoryId": "9",
                        "secondCategoryName": "晚礼服",
                        "comments": ""
                    },{
                        "secondCategoryId": "92",
                        "firstCategoryId": "9",
                        "secondCategoryName": "婚纱",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "9.png"
                },
                {
                    "firstCategoryId": "10",
                    "firstCategoryName": "风衣",
                    "secondCategoryVO":[{
                        "secondCategoryId": "101",
                        "firstCategoryId": "10",
                        "secondCategoryName": "中长款",
                        "comments": ""
                    },{
                        "secondCategoryId": "102",
                        "firstCategoryId": "10",
                        "secondCategoryName": "长款",
                        "comments": ""
                    }],
                    "comments": null,
                    "image": category_url + "10.png"
                }
            ]
        }
    };
    res.send(data);
});

module.exports = router;